import 'dart:convert';

import 'package:drop_down_list/drop_down_list.dart';
import 'package:drop_down_list/model/selected_list_item.dart';
import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:flutter/material.dart';
import 'package:dropdown_below/dropdown_below.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:http/http.dart' as http;
import 'package:provider/provider.dart';
import '../provider/person_info.dart';
import '../tool/radio.dart';

// ignore: must_be_immutable
class TitleTable extends StatefulWidget {
  PersonInfo person;
  List<dynamic> actlist;
  final Function(PersonInfo, String) setVaule;

  String selectvalue;

  TitleTable(
      {super.key,
      required this.actlist,
      required this.setVaule,
      required this.selectvalue,
      required this.person});

  @override
  State<StatefulWidget> createState() => _TitleTable();
}

class _TitleTable extends State<TitleTable> {
  List<dynamic> actlist = [];

  @override
  Widget build(BuildContext context) {
    return Consumer<PersonInfo>(builder: (ctx, person, child) {
      return Container(
        margin: const EdgeInsets.only(top: 30),
        padding: const EdgeInsets.only(left: 10, right: 10),
        width: double.infinity, // 宽度设置为100%
        height: 60,
        decoration: BoxDecoration(
          border: Border.all(
            color: const Color.fromARGB(255, 107, 102, 102),
            width: 1,
          ),
        ),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Text(
              "     ",
            ),
            singleChoice(
                items: widget.actlist != [] ? widget.actlist : ["错误"],
                selectedValue:
                    widget.selectvalue != "" ? widget.selectvalue : "错误",
                setvalue: widget.setVaule),
            Text("     "),
          ],
        ),
      );
    });
  }
}
